Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify codegen for is-expressions #65845

Closed
wants to merge 1 commit into from
Closed

Conversation

alrz
Copy link
Member

@alrz alrz commented Dec 7, 2022

Fixes #55334, #59615

Didn't update the baseline just yet because this results in slightly worse codegen in a few cases.

@ghost ghost added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Dec 7, 2022
(true, false) => LowerTest(testNode.Test),
(false, true) => _factory.Not(LowerTest(testNode.Test)),
(null, true) => _factory.LogicalOr(_factory.Not(LowerTest(testNode.Test)), whenTrue),
(null, false) => _factory.LogicalAnd(LowerTest(testNode.Test), whenTrue),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of issues with this approach:

  1. This expression is deep on the right-hand-side and emitter generates a different (worse) code for that.
  2. There a chance to produce duplicated checks because the entire graph is inlined. (no test coverage there)
  3. This should be able to incorporate switch optimizations: Emit switch for suitable 'or' patterns #45679

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Community The pull request was submitted by a contributor who is not a Microsoft employee.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pattern matching causing redundant jumps in generated IL (maybe a bug, maybe a good reason?)
1 participant